package com.hr.system.service.impl;

import java.util.List;
import com.hr.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hr.system.mapper.SysDeductionMapper;
import com.hr.system.domain.SysDeduction;
import com.hr.system.service.ISysDeductionService;
import com.hr.common.core.text.Convert;

/**
 * 员工工资扣除项Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-04-29
 */
@Service
public class SysDeductionServiceImpl implements ISysDeductionService 
{
    @Autowired
    private SysDeductionMapper sysDeductionMapper;

    /**
     * 查询员工工资扣除项
     * 
     * @param id 员工工资扣除项ID
     * @return 员工工资扣除项
     */
    @Override
    public SysDeduction selectSysDeductionById(Long id)
    {
        return sysDeductionMapper.selectSysDeductionById(id);
    }

    /**
     * 查询员工工资扣除项列表
     * 
     * @param sysDeduction 员工工资扣除项
     * @return 员工工资扣除项
     */
    @Override
    public List<SysDeduction> selectSysDeductionList(SysDeduction sysDeduction)
    {
        return sysDeductionMapper.selectSysDeductionList(sysDeduction);
    }

    /**
     * 新增员工工资扣除项
     * 
     * @param sysDeduction 员工工资扣除项
     * @return 结果
     */
    @Override
    public int insertSysDeduction(SysDeduction sysDeduction)
    {
        sysDeduction.setCreateTime(DateUtils.getNowDate());
        return sysDeductionMapper.insertSysDeduction(sysDeduction);
    }

    /**
     * 修改员工工资扣除项
     * 
     * @param sysDeduction 员工工资扣除项
     * @return 结果
     */
    @Override
    public int updateSysDeduction(SysDeduction sysDeduction)
    {
        sysDeduction.setUpdateTime(DateUtils.getNowDate());
        return sysDeductionMapper.updateSysDeduction(sysDeduction);
    }

    /**
     * 删除员工工资扣除项对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysDeductionByIds(String ids)
    {
        return sysDeductionMapper.deleteSysDeductionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除员工工资扣除项信息
     * 
     * @param id 员工工资扣除项ID
     * @return 结果
     */
    @Override
    public int deleteSysDeductionById(Long id)
    {
        return sysDeductionMapper.deleteSysDeductionById(id);
    }
}
